import { defineConfig } from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import cesiumPlugin from 'vite-plugin-cesium'
import path from "path"

// https://vite.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    host: true,
    port: 8080,
    cors: true,
    // 配置代理
    proxy:{
      "/zk":{
        target:'https://pre.zkong.com',//设置代理目标
        changeOrigin:true,//是否改变请求源地址
      },
      "/lcd":{
        target:'https://pre.zkong.com',//设置代理目标
        changeOrigin:true,//是否改变请求源地址
        rewrite: (path) => path.replace(/^\/lcd/,''),//将/api 替换成空字符串
      }
    }
  },
  plugins: [
    vuePlugin(),
    cesiumPlugin()
  ],
})
